/*
 * Created on Mar 18, 2009
 */
package com.mgmaps.app;

import javax.microedition.lcdui.Command;
// import ro.letsdoitromania.LDIRSettings;
import com.mgmaps.utils.LS;

public class APPCommands {
  
  // commands
  public final Command okCommand;
  public final Command cancelCommand;
  public final Command settingsCommand;
  public final Command exitCommand;
  public final Command backCommand;
  public final Command mainBackCommand;
  public final Command selectCommand;
  public final Command findmeCommand;
  public final Command searchCommand;
  public final Command clearCommand;
  public final Command helpCommand;
  public final Command aboutCommand;
  public final Command enableGPSCommand;
  public final Command disableGPSCommand;
  public final Command viewMapCommand;
  
  public final Command addCommand;
  public final Command editCommand;
  public final Command deleteCommand;
  public final Command continueCommand;

  public final Command mapCommand;
  public final Command phoneCommand;
  public final Command urlCommand;
  public final Command mapCommandItem;
  public final Command phoneCommandItem;
  public final Command urlCommandItem;
  
  // public final Command viewLogCommand;
  
  public static APPCommands instance;
  
  protected boolean hasMapBackCommand;
  protected boolean hasMapExitCommand;
  
  public final Command btSelectCommand;
  public final Command btRefreshCommand;
  public final Command btCancelCommand;
  public final Command btCompleteCommand;
  
  public static void initialize() {
    instance = new APPCommands();
  }
  
  protected APPCommands() {
    // commmands
    okCommand = new Command(LS.get("app.command.ok"), Command.SCREEN, 1);
    selectCommand = new Command(LS.get("app.command.select"), Command.SCREEN, 5);
    findmeCommand = new Command(LS.get("app.command.findme"), Command.SCREEN, 10);
    searchCommand = new Command(LS.get("app.command.search"), Command.SCREEN, 11);
    enableGPSCommand = new Command(LS.get("app.command.enablegps"), Command.SCREEN, 13);
    disableGPSCommand = new Command(LS.get("app.command.disablegps"), Command.SCREEN, 14);
    viewMapCommand = new Command(LS.get("app.command.viewmap"), Command.SCREEN, 15);
    settingsCommand = new Command(LS.get("app.command.settings"), Command.SCREEN, 20);
    helpCommand = new Command(LS.get("app.command.help"), Command.SCREEN, 29);
    aboutCommand = new Command(LS.get("app.command.about"), Command.SCREEN, 30);
    
    addCommand = new Command(LS.get("app.command.add"), Command.SCREEN, 21);
    editCommand = new Command(LS.get("app.command.edit"), Command.SCREEN, 22);
    deleteCommand = new Command(LS.get("app.command.delete"), Command.SCREEN, 23);
    continueCommand = new Command(LS.get("app.command.continue"), Command.SCREEN, 24);
    
    clearCommand = new Command(LS.get("app.command.clear"), Command.SCREEN, 35);
    
    mapCommand = new Command(LS.get("app.command.viewonmap"), Command.SCREEN, 40);
    phoneCommand = new Command(LS.get("app.command.call"), Command.SCREEN, 41);
    urlCommand = new Command(LS.get("app.command.webvisit"), Command.SCREEN, 42);
    mapCommandItem = new Command(LS.get("app.command.viewonmap"), Command.ITEM, 43);
    phoneCommandItem = new Command(LS.get("app.command.call"), Command.ITEM, 44);
    urlCommandItem = new Command(LS.get("app.command.webvisit"), Command.ITEM, 45);
    
    /*
    if (LDIRSettings.LOG_AVAILABLE)
      viewLogCommand = new Command("View Log", Command.SCREEN, 50);
    else
      viewLogCommand = null;
    */
    
    cancelCommand = new Command(LS.get("app.command.cancel"), Command.BACK, 97);
    backCommand = new Command(LS.get("app.command.back"), Command.BACK, 98);
    
    // all commands shown on the map screen should be Command.SCREEN for generic (Nokia)
    // but the back ones should be Command.BACK/Command.EXIT for BB
    if (!hasMapBackCommand || APPSettings.isBlackberry)
      mainBackCommand = new Command(LS.get("app.command.back"), Command.BACK, 99);  // blackberry
    else
      mainBackCommand = new Command(LS.get("app.command.back"), Command.SCREEN, 99);  // generic
    if (!hasMapExitCommand || APPSettings.isBlackberry)
      exitCommand = new Command(LS.get("app.command.exit"), Command.EXIT, 100);  // blackberry
    else
      exitCommand = new Command(LS.get("app.command.exit"), Command.SCREEN, 100);  // generic
    
    if (APPSettings.hasBT) {
      btSelectCommand = new Command(LS.get("bt.select"), Command.SCREEN, 2001);
      btRefreshCommand = new Command(LS.get("bt.refresh"), Command.SCREEN, 2002);
      btCancelCommand = new Command(LS.get("bt.cancel"), Command.BACK, 2003);
      btCompleteCommand = new Command(LS.get("bt.done"), Command.SCREEN, 2004);
    }
    else {
      btSelectCommand = null;
      btRefreshCommand = null;
      btCancelCommand = null;
      btCompleteCommand = null;
    }
  }

}
